package com.endoc.designpattern.entity.fruit;

import com.endoc.designpattern.entity.Fruit;
import com.endoc.designpattern.visit.Visit;

public class Orange  implements Fruit {
    int price;
    public void setPrice(int price) {
        this.price = price;
    }
    public Orange(int price) {
        this.price = price;
    }

    @Override
    public int price() {
        return price;
    }

    @Override
    public String name() {
        return "橘子";
    }
    @Override
    public void setVisit(Visit visit) {
        //访问者模式,可得到真实对象
        visit.sell(this);
    }
}
